local skill = fk.CreateSkill{
  name = "iberia__rende"
}

Fk:loadTranslationTable{
  ["iberia__rende"] = "仁德",
  [":iberia__rende"] = "出牌阶段限一次，你可以分配至少一张手牌，然后可以视为对一名已受伤的角色使用【桃】。",
  ["#iberia__rende"] = "仁德：可以分配至少一张手牌，然后可以视为对一名已受伤的角色使用【桃】",

  ["#iberia__rende-prompt"] = "仁德：可以视为对一名已受伤的角色使用【桃】"
}

skill:addEffect("active", {
  anim_type = "support",
  prompt = "#iberia__rende",
  max_phase_use_time = 1,
  can_use = function(self, player)
    return player:getHandcardNum() > 0
    and player:usedSkillTimes(skill.name, Player.HistoryPhase) < 1
  end,
  target_num = 0,
  card_num = 0,
  on_use = function(self, room, effect)
    room:askToYiji(effect.from, {
      targets = room:getOtherPlayers(effect.from, false),
      cards = effect.from:getCardIds("h"),
      max_num = 999,
      min_num = 1,
      skill_name = skill.name,
      cancelable = false,
    })

    if effect.from.dead then return end
    local card = Fk:cloneCard("peach")
    card.skillName = skill.name
    if effect.from:prohibitUse(card) then return end
    local players = table.filter(room:getAlivePlayers(false), function(p)
      return p:isWounded() and not effect.from:isProhibited(p, card)
    end)

    local tos = room:askToChoosePlayers(effect.from, {
      targets = players,
      min_num = 1,
      max_num = 1,
      skill_name = skill.name,
      prompt = "#iberia__rende-prompt",
      cancelable = true,
      no_indicate = true
    })

    if tos and #tos == 1 then
      room:useCard{
        card = card,
        tos = tos,
        from = effect.from,
        skill_name = skill.name,
      }
    end
  end
})

return skill
